$(document).ready(function () {
    yhxx.onload();
})
var yhxx = (function () {
	var init = function () {
    	layui.use('form', function(){
			  var form = layui.form
		});
    }
    return {
        onload : function () {
        	init();
            yhxx.tableDataYh();
            yhxx.dateShow();
            yhxx.yhAlert()
        },
       /*表格数据交互*/
      tableDataYh: function() {
 		var data = [{
 				"number": "1",
 				"zsxm":"增值税",
 				"yhMoney": "200.00",
 				"yhNumber":'2'
 			},
 			{
 				"number": "2",
 				"zsxm":"增值税",
 				"yhMoney": "200.00",
 				"yhNumber":'2'
 			},
 			{
 				"number": "3",
 				"zsxm":"增值税",
 				"yhMoney": "200.00",
 				"yhNumber":'2'
 			},
 			{
 				"number": "4",
 				"zsxm":"增值税",
 				"yhMoney": "200.00",
 				"yhNumber":'2'
 			}
 		];
 		$('#wepYhxx').DataTable({
 			"data": data,
 			"columns": [
 			    {
 					"data": "number"
 				},
 				{
 					"data": "zsxm"
 				},
 				{
 					"data": "yhMoney"
 				},
 				{
 					"data": "yhNumber"
 				}
 			],
// 			"paging": false,
 			"info": false,
 			"ordering": false,
 			"lengthChange": false,
 			"searching": false,
 			"fnInitComplete": function (oSettings, json) {/*判断认证状态显示字体颜色*/
	            for(var i=0;i<$('#wepYhxx tbody tr').length;i++){
	            	$('#wepYhxx tbody tr').eq(i).find('td').eq(3).addClass('wep_yh_alertbtn').css({
	            		'color':"#1e9fff",
	            		"cursor":"pointer"
	            	})
	            }
	        }
 		});
     },
     /*点击条数弹出框*/
    yhAlert:function(){
    	$(document).on('click','.wep_yh_alertbtn',function(){
    		parent.cxzx.alertBox('.wep_yhxx_alert')
    	})
    },
     /*日期显示*/
        dateShow:function(){
        	layui.use('laydate', function(){
			  var laydate = layui.laydate;
			  function dateObj(dom1,dom2){//结束时间不小于开始时间
					var startDate   = laydate.render({
						elem: dom1,
						done:function(value,date){
							if( value !== '' ){
								endDate.config.min.year = date.year;
								endDate.config.min.month = date.month - 1;
								endDate.config.min.date = date.date;
							}else{
								endDate.config.min.year = '';
								endDate.config.min.month = '';
								endDate.config.min.date = '';
							}
						}
					});
					var endDate  = laydate.render({
						elem: dom2,
						done:function(value,date){
							if( value !== '' ){
								startDate.config.max.year = date.year;
								startDate.config.max.month = date.month - 1;
								startDate.config.max.date = date.date;
							}else{
								startDate.config.max.year = '';
								startDate.config.max.month = '';
								startDate.config.max.date = '';
							}
						}
					});
				}
				dateObj('#wep_date1','#wep_date2');
			})
        }
    }
})();